package main

import "fmt"

//string 基本使用
func main() {
	var address string = "北京长城 110 hello world!"
	fmt.Println("地址:", address)
	//字符串一旦赋值,字符串就不能修改:在go中字符串是不可变的
	var str = "hello"
	//str[0]='y'
	fmt.Println("str=", str)
	//特殊字符处理
	str2 := "abc\nabc"
	fmt.Println("str2=", str2)
	//字符串拼接
	var str3 = "hello " + "world"
	str3 += " haha!"
	fmt.Println("str3=", str3)
	//当要拼接一个很长的字符串,加号必须是在末尾
	var str4 = "hello " + "world" +
		"hello " + "world" +
		"hello " + "world" +
		"hello " + "world"
	fmt.Println("str4=", str4)
}
